<template>
	<view>
		<view class="list">
			<view class="ul flex align-center">
				<image class="image" src="/static/images/share/weixin.png">
				<button class="button" open-type="share" hover-class="none" :plain="true" >方式一：通过微信邀请</button>
			</view>
			
		</view>
		<view class="list" @tap="copyCircleId">
			<view class="ul flex align-center">
				<image class="image" src="/static/images/share/kouling.png"> 
				<button class="button"  hover-class="none" :plain="true" >方式二：通过圈子口令邀请</button> 
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				circleInfo:{}
			}
		},
		onLoad() {
			var info = uni.getStorageSync('group-share-circleinfo');
			this.circleInfo = info;
		},
		methods: {
			copyCircleId(){
				var that = this;
				that.$api.showModal('复制圈子口令','通过圈子口令加入圈子',function(res){
					if(res == 'yes')
					{
						that.$api.copyText(that.circleInfo.circle_id);
					}
				})
			}
		},
		onShareAppMessage(e)
		{
			var userInfo = this.$api.checkUserInfo();
			var nickname = userInfo.nickname?userInfo.nickname:'';
			var imageUrl = this.$api.getSystemConfig('base.group_share_bg');
			var obj =  {
			    title: nickname+'邀请你加入圈子',
			    path: '/pages/group/group-join?circle_id='+this.circleInfo.circle_id
			}
			if(imageUrl)
			{
				obj.imageUrl = imageUrl;
			}
			return obj;
		}
	}
</script>

<style lang="scss">
	.list{
		width: 94%;
		margin: 20rpx auto;
		height: 160rpx;
		background-color: #FFFFFF;
		border-radius: 20rpx;
		.ul{
			height: 100%;
			position: relative;
			.image{
				position: absolute;
				width: 80rpx;
				height: 80rpx;
				left: 20rpx;
				top: 40rpx;
			}
			.button{
				width: 100%;
				border: none;
				text-align: left;
				font-size: 28rpx;
				padding-left: 140rpx;
				height: 100%;
				line-height: 160rpx;
			}
		}
	}
</style>
